package App;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

public class Bolas extends javax.swing.JFrame {
    /*testando comit*/

    private String bolaEscolhida = "bola0";
    private Principal principal;

    public Bolas(Principal principal) {

        this.principal = principal;

        initComponents();
        bola1.setIcon(new ImageIcon("./Imagens/bola1.png"));
        bola2.setIcon(new ImageIcon("./Imagens/bola2.png"));
        bola3.setIcon(new ImageIcon("./Imagens/bola3.png"));
        bola4.setIcon(new ImageIcon("./Imagens/bola4.png"));
        bola5.setIcon(new ImageIcon("./Imagens/bola5.png"));
        bola6.setIcon(new ImageIcon("./Imagens/bola6.png"));
        bola7.setIcon(new ImageIcon("./Imagens/bola7.png"));
        bola8.setIcon(new ImageIcon("./Imagens/bola8.png"));
        bola9.setIcon(new ImageIcon("./Imagens/bola9.png"));
        bola10.setIcon(new ImageIcon("./Imagens/bola10.png"));
        bola11.setIcon(new ImageIcon("./Imagens/bola11.png"));
        bola12.setIcon(new ImageIcon("./Imagens/bola12.png"));
        bola13.setIcon(new ImageIcon("./Imagens/bola13.png"));
        bola14.setIcon(new ImageIcon("./Imagens/bola14.png"));
        bola15.setIcon(new ImageIcon("./Imagens/bola15.png"));

    }
    

    
    

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        bola1 = new javax.swing.JButton();
        bola2 = new javax.swing.JButton();
        bola3 = new javax.swing.JButton();
        bola4 = new javax.swing.JButton();
        bola5 = new javax.swing.JButton();
        bola6 = new javax.swing.JButton();
        bola7 = new javax.swing.JButton();
        bola8 = new javax.swing.JButton();
        bola9 = new javax.swing.JButton();
        bola10 = new javax.swing.JButton();
        bola11 = new javax.swing.JButton();
        bola12 = new javax.swing.JButton();
        bola13 = new javax.swing.JButton();
        bola14 = new javax.swing.JButton();
        bola15 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setResizable(false);

        bola1.setName("bola1"); // NOI18N
        bola1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                escolhaDaBola(evt);
            }
        });

        bola2.setName("bola2"); // NOI18N
        bola2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                escolhaDaBola(evt);
            }
        });

        bola3.setName("bola3"); // NOI18N
        bola3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                escolhaDaBola(evt);
            }
        });

        bola4.setName("bola4"); // NOI18N
        bola4.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                escolhaDaBola(evt);
            }
        });

        bola5.setName("bola5"); // NOI18N
        bola5.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                escolhaDaBola(evt);
            }
        });

        bola6.setName("bola6"); // NOI18N
        bola6.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                escolhaDaBola(evt);
            }
        });

        bola7.setName("bola7"); // NOI18N
        bola7.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                escolhaDaBola(evt);
            }
        });

        bola8.setName("bola8"); // NOI18N
        bola8.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                escolhaDaBola(evt);
            }
        });

        bola9.setName("bola9"); // NOI18N
        bola9.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                escolhaDaBola(evt);
            }
        });

        bola10.setName("bola10"); // NOI18N
        bola10.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                escolhaDaBola(evt);
            }
        });

        bola11.setName("bola11"); // NOI18N
        bola11.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                escolhaDaBola(evt);
            }
        });

        bola12.setName("bola12"); // NOI18N
        bola12.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                escolhaDaBola(evt);
            }
        });

        bola13.setName("bola13"); // NOI18N
        bola13.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                escolhaDaBola(evt);
            }
        });

        bola14.setName("bola14"); // NOI18N
        bola14.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                escolhaDaBola(evt);
            }
        });

        bola15.setName("bola15"); // NOI18N
        bola15.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                escolhaDaBola(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(bola1, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(bola2, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(bola3, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(bola4, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(bola5, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(bola6, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(bola7, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(bola8, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(bola9, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(bola10, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(bola11, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(bola13, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(bola14, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(bola12, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(bola15, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(bola1, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(bola2, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(bola3, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(bola4, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(bola5, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(bola6, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(bola7, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(bola8, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(bola9, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(bola10, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(bola11, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(bola12, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(bola13, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(bola14, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(bola15, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    public void funcaoEscolherBola() {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Bolas(principal).setVisible(true);
            }
        });
    }

private void escolhaDaBola(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_escolhaDaBola
    this.bolaEscolhida = ((JButton) evt.getComponent()).getName();
    this.setVisible(false);
    this.principal.setBotaoSelecionado(this.bolaEscolhida);
    this.principal.imagemBola();
}//GEN-LAST:event_escolhaDaBola

   

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton bola1;
    private javax.swing.JButton bola10;
    private javax.swing.JButton bola11;
    private javax.swing.JButton bola12;
    private javax.swing.JButton bola13;
    private javax.swing.JButton bola14;
    private javax.swing.JButton bola15;
    public javax.swing.JButton bola2;
    private javax.swing.JButton bola3;
    private javax.swing.JButton bola4;
    private javax.swing.JButton bola5;
    private javax.swing.JButton bola6;
    private javax.swing.JButton bola7;
    private javax.swing.JButton bola8;
    private javax.swing.JButton bola9;
    // End of variables declaration//GEN-END:variables
}
